<!DOCTYPE html>
<html lang=zh>
<head><meta name="generator" content="Hexo 3.9.0">
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="description" content="前言有时候想法太多也不是个好事，最近想做的项目有三个：  上线毕设项目—微书 实现一个博客的评论系统—wecomment 实现一个图片上传工具，方便自己写博客—ldk-upload-img  谈正题，讲下自己学习scrapy的过程，以及如何写一个爬虫。学习一个新框架最好的方法就是去看它的官网，初次打开scrapy的官网，眼前一亮，让自己瞬间但觉到要是能掌握这门武技就能变成无敌黑客。 安装scrap">
<meta name="keywords" content="毕设,python">
<meta property="og:type" content="article">
<meta property="og:title" content="Python scrapy入门">
<meta property="og:url" content="https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/index.html">
<meta property="og:site_name" content="月光倾城的代码小屋">
<meta property="og:description" content="前言有时候想法太多也不是个好事，最近想做的项目有三个：  上线毕设项目—微书 实现一个博客的评论系统—wecomment 实现一个图片上传工具，方便自己写博客—ldk-upload-img  谈正题，讲下自己学习scrapy的过程，以及如何写一个爬虫。学习一个新框架最好的方法就是去看它的官网，初次打开scrapy的官网，眼前一亮，让自己瞬间但觉到要是能掌握这门武技就能变成无敌黑客。 安装scrap">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://ouizhbgin.bkt.clouddn.com/blog/2017/10/28/scrapy_office.png">
<meta property="og:updated_time" content="2020-01-15T06:30:09.120Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Python scrapy入门">
<meta name="twitter:description" content="前言有时候想法太多也不是个好事，最近想做的项目有三个：  上线毕设项目—微书 实现一个博客的评论系统—wecomment 实现一个图片上传工具，方便自己写博客—ldk-upload-img  谈正题，讲下自己学习scrapy的过程，以及如何写一个爬虫。学习一个新框架最好的方法就是去看它的官网，初次打开scrapy的官网，眼前一亮，让自己瞬间但觉到要是能掌握这门武技就能变成无敌黑客。 安装scrap">
<meta name="twitter:image" content="http://ouizhbgin.bkt.clouddn.com/blog/2017/10/28/scrapy_office.png">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
          
        
    
    <!-- title -->
    <title>Python scrapy入门</title>
    <!-- styles -->
    <link rel="stylesheet" href="/css/style.css">
    <!-- persian styles -->
    
      <link rel="stylesheet" href="/css/rtl.css">
    
    <!-- rss -->
    
    
</head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/2017/10/28/python_scrapy_selector/"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/2017/10/17/window_mongo_install/"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">上一篇</span>
      <span id="i-next" class="info" style="display:none;">下一篇</span>
      <span id="i-top" class="info" style="display:none;">返回顶部</span>
      <span id="i-share" class="info" style="display:none;">分享文章</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&text=Python scrapy入门"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&is_video=false&description=Python scrapy入门"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=Python scrapy入门&body=Check out this article: https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&name=Python scrapy入门&description="><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#安装scrapy"><span class="toc-number">2.</span> <span class="toc-text">安装scrapy</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#scrapy创建以及运行项目"><span class="toc-number">3.</span> <span class="toc-text">scrapy创建以及运行项目</span></a></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        Python scrapy入门
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">月光倾城的代码小屋</span>
      </span>
      
    <div class="postdate">
        <time datetime="2017-10-28T12:15:00.000Z" itemprop="datePublished">2017-10-28</time>
    </div>


      

      
    <div class="article-tag">
        <i class="fas fa-tag"></i>
        <a class="tag-link" href="/tags/python/">python</a>, <a class="tag-link" href="/tags/毕设/">毕设</a>
    </div>


    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <h4 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h4><p>有时候想法太多也不是个好事，最近想做的项目有三个：</p>
<ol>
<li>上线毕设项目—<a href="https://github.com/AndyliStudio/graduationDesign" target="_blank" rel="noopener">微书</a></li>
<li>实现一个博客的评论系统—<a href="https://github.com/andyliwr/wecomment" target="_blank" rel="noopener">wecomment</a></li>
<li>实现一个图片上传工具，方便自己写博客—<a href="https://github.com/andyliwr/ldk-upload-img" target="_blank" rel="noopener">ldk-upload-img</a></li>
</ol>
<p>谈正题，讲下自己学习<code>scrapy</code>的过程，以及如何写一个爬虫。学习一个新框架最好的方法就是去看它的官网，初次打开<code>scrapy</code>的官网，眼前一亮，让自己瞬间但觉到要是能掌握这门武技就能变成无敌黑客。<br><img src="http://ouizhbgin.bkt.clouddn.com/blog/2017/10/28/scrapy_office.png" alt="scrapy官网"></p>
<h4 id="安装scrapy"><a href="#安装scrapy" class="headerlink" title="安装scrapy"></a>安装<code>scrapy</code></h4><ol>
<li><p><strong>windows 下安装</strong><br>python 安装包的时候依赖关系复杂，有时候存粹使用<code>pip install xxx</code>并不能安装成功，我们得找条捷径。参考官网给的安装教程，我选择了使用<a href="https://anaconda.org" target="_blank" rel="noopener">anaconda</a>。可是国内访问国外网站很慢，而且奇葩的时<code>anaconda</code>还很大，大概 400 多 M.。当我发现我睡了一觉起来还没有下载成功的时候，果断点击了<code>取消下载</code>。这里给大家推荐两个镜像： + 清华大学<code>anaconda</code>镜像 — <a href="https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/" target="_blank" rel="noopener">https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/</a>，如不能访问，请使用下面一个清华大学镜像还给了个替换<code>corda</code>下载源的方法，我试了下确实安装依赖速度上提升不少<br><code>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes</code> + 中国科学技术大学镜像 — <a href="http://mirrors.ustc.edu.cn/" target="_blank" rel="noopener">http://mirrors.ustc.edu.cn</a></p>
<pre><code>总之呢，下载下来`anaconda`的安装`exe`文件，然后一直点击下一步`安装`就行。windows版本的`anaconda`还带有一个管理界面，安装包只需要搜索下，点击安装就好了。而且不用每次打开cmd去激活anaconda，管理界面也有打开cmd和Ipython的快捷方式。
![anaconda包管理器](http://ouizhbgin.bkt.clouddn.com/blog/2017/10/28/scrapy_anaconda_ev.png)
![anaconda打开终端](http://chuantu.biz/t6/115/1509161137x2890174172.png)
</code></pre></li>
<li><p><strong>linux 下安装</strong><br>linux 下的安装和 window 下类似，只是是下载<code>xxx.sh</code>文件，最后就是阅读安装协议，配置安装地址之类的。</p>
</li>
</ol>
<figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="string">./xxx.sh</span></span><br></pre></td></tr></table></figure>
<h4 id="scrapy创建以及运行项目"><a href="#scrapy创建以及运行项目" class="headerlink" title="scrapy创建以及运行项目"></a><code>scrapy</code>创建以及运行项目</h4><p>创建项目，在终端中输入<code>scrapy startproject first_spider</code>，创建完成之后项目结构如下：</p>
<figure class="highlight livecodeserver"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">tutorial/</span><br><span class="line">  scrapy.cfg          <span class="comment"># 部署爬虫的配置文件</span></span><br><span class="line">  tutorial/           <span class="comment"># 项目根目录</span></span><br><span class="line">    __init__.py</span><br><span class="line">    <span class="keyword">items</span>.py          <span class="comment"># 定义每个爬虫需要爬取的数据结构</span></span><br><span class="line">    pipelines.py      <span class="comment"># 处理爬虫得到的数据，去重，存入数据库</span></span><br><span class="line">    settings.py       <span class="comment"># 爬虫设置</span></span><br><span class="line">    spiders/          <span class="comment"># 爬虫目录，放置所有的爬虫</span></span><br><span class="line">      __init__.py</span><br></pre></td></tr></table></figure>
<ol>
<li><strong>新建一个爬虫 axdzs</strong></li>
</ol>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"># <span class="selector-tag">genspider</span>后面的第一个参数是爬虫的名称，第二个是爬虫爬取的网址</span><br><span class="line"><span class="selector-tag">scrapy</span> <span class="selector-tag">genspider</span> <span class="selector-tag">quotes</span> <span class="selector-tag">quotes</span><span class="selector-class">.toscrape</span><span class="selector-class">.com</span></span><br></pre></td></tr></table></figure>
<ol start="2">
<li><strong>修改 spiders 目录下新生成的 quotes.py 文件为如下代码</strong>：</li>
</ol>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> scrapy</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">QuotesSpider</span><span class="params">(scrapy.Spider)</span>:</span></span><br><span class="line">    name = <span class="string">"quotes"</span> <span class="comment"># 定义爬虫的名字</span></span><br><span class="line"></span><br><span class="line">    <span class="comment"># 发送请求</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">start_requests</span><span class="params">(self)</span>:</span></span><br><span class="line">        urls = [</span><br><span class="line">            <span class="string">'http://quotes.toscrape.com/page/1/'</span>,</span><br><span class="line">            <span class="string">'http://quotes.toscrape.com/page/2/'</span>,</span><br><span class="line">        ]</span><br><span class="line">        <span class="keyword">for</span> url <span class="keyword">in</span> urls:</span><br><span class="line">            <span class="keyword">yield</span> scrapy.Request(url=url, callback=self.parse)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 处理请求返回的数据</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">parse</span><span class="params">(self, response)</span>:</span></span><br><span class="line">        <span class="comment"># response相当于一个html对象，里面包含原页面所有html元素</span></span><br><span class="line">        page = response.url.split(<span class="string">"/"</span>)[<span class="number">-2</span>]</span><br><span class="line">        filename = <span class="string">'quotes-%s.html'</span> % page</span><br><span class="line">        <span class="comment"># 打开文件，将response存储进去</span></span><br><span class="line">        <span class="keyword">with</span> open(filename, <span class="string">'wb'</span>) <span class="keyword">as</span> f:</span><br><span class="line">            f.write(response.body)</span><br><span class="line">        self.log(<span class="string">'Saved file %s'</span> % filename)</span><br></pre></td></tr></table></figure>
<ol start="3">
<li><strong>运行爬虫</strong></li>
</ol>
<figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">scrapy crawl quotes</span></span><br></pre></td></tr></table></figure>
<p>在控制台看到如下输出，并且项目根目录下多了两个文件 — quotes1.html 和 quotes2.html：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">2016-12-16 21:24:05 [scrapy.core.engine] INFO: Spider opened</span><br><span class="line">2016-12-16 21:24:05 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)</span><br><span class="line">2016-12-16 21:24:05 [scrapy.extensions.telnet] DEBUG: Telnet console listening on 127.0.0.1:6023</span><br><span class="line">2016-12-16 21:24:05 [scrapy.core.engine] DEBUG: Crawled (404) &lt;GET http://quotes.toscrape.com/robots.txt&gt; (referer: None)</span><br><span class="line">2016-12-16 21:24:05 [scrapy.core.engine] DEBUG: Crawled (200) &lt;GET http://quotes.toscrape.com/page/1/&gt; (referer: None)</span><br><span class="line">2016-12-16 21:24:05 [scrapy.core.engine] DEBUG: Crawled (200) &lt;GET http://quotes.toscrape.com/page/2/&gt; (referer: None)</span><br><span class="line">2016-12-16 21:24:05 [quotes] DEBUG: Saved file quotes-1.html</span><br><span class="line">2016-12-16 21:24:05 [quotes] DEBUG: Saved file quotes-2.html</span><br><span class="line">2016-12-16 21:24:05 [scrapy.core.engine] INFO: Closing spider (finished)</span><br></pre></td></tr></table></figure>
<p>如此一个最简单的爬虫就写好了，有木有很简单？在接下来的文章，我将继续介绍 scrapy 的进阶内容，敬请期待~</p>

  </div>
  <div class="statement">
    <hr>  
    1. 如果本文帮到了您，不妨点一下右上角的”<i class="fas fa-share-alt"></i>“按钮。<br>
    2. 除非注明，本博文章均为原创，转载请以链接形式标明本文地址。<br>
    3. 如果你有任何疑问，欢迎发送邮件到我的邮箱<a href="mailto:andyliwr@outlook.com">andyliwr@outlook.com<br>
  </div>
</article>


    <div class="blog-post-comments">
        <div id="gitalk_thread">
            <noscript>加载评论需要在浏览器启用 JavaScript 脚本支持。</noscript>
        </div>
    </div>



        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#安装scrapy"><span class="toc-number">2.</span> <span class="toc-text">安装scrapy</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#scrapy创建以及运行项目"><span class="toc-number">3.</span> <span class="toc-text">scrapy创建以及运行项目</span></a></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&text=Python scrapy入门"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&is_video=false&description=Python scrapy入门"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=Python scrapy入门&body=Check out this article: https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&title=Python scrapy入门"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2017/10/28/python_scrapy_rumen/&name=Python scrapy入门&description="><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> 菜单</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> 目录</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> 分享</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> 返回顶部</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2020 Dikang Li
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
</body>
</html>
<!-- styles -->
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">
<link rel="stylesheet" href="/lib/fancybox/jquery.fancybox.css">

<link rel="stylesheet" href="https://file.lantingshucheng.com/blog/v3/static/styles/gitalk.css">


<!-- jquery -->
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>
<script src="/lib/fancybox/jquery.fancybox.pack.js"></script>

<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/md5.js"></script>
<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/gitalk.min.js"></script>

<script src="/js/main.js"></script>
<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

    <script type="text/javascript">
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?7851ca7a86be957be994acb77639a5be";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

<!-- Disqus Comments -->


  <script type="text/javascript">
    window.onload = function(){
      if (window.location.href.indexOf('andyliwr.github.io') > -1) {
        var gitalk = new Gitalk({
          clientID: 'ad6f70df0c70d2b715f9',
          clientSecret: '40384bee244c1e17dd7c37733d21e9ef669e969c',
          repo: 'Andyliwr.github.io',
          owner: 'Andyliwr',
          admin: ['Andyliwr'],
          id: md5(location.pathname),
          distractionFreeMode: 'true'
        })
        gitalk.render('gitalk_thread')
      }
    }
  </script>


